home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / OS / FWGraphx / Include / FWShape.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  5.2 KB  |  195 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWShape.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWSHAPE_H
  13. #define FWSHAPE_H
  14.  
  15. #ifndef FWGROBJ_H
  16. #include "FWGrObj.h"
  17. #endif
  18.  
  19. #ifndef FWPOINT_H
  20. #include "FWPoint.h"
  21. #endif
  22.  
  23. #ifndef FWRECT_H
  24. #include "FWRect.h"
  25. #endif
  26.  
  27. #ifndef FWGRDEF_H
  28. #include "FWGrDef.h"
  29. #endif
  30.  
  31. #ifndef FWINK_H
  32. #include "FWInk.h"
  33. #endif
  34.  
  35. #ifndef FWSTYLE_H
  36. #include "FWStyle.h"
  37. #endif
  38.  
  39. #ifndef FWDFAULT_H
  40. #include "FWDfault.h"
  41. #endif
  42.  
  43. //========================================================================================
  44. //    •• Forward Declarations
  45. //========================================================================================
  46.  
  47. class FW_CGraphicContext;
  48. class XMPTransform;
  49. class FW_CShapeRep;
  50.  
  51. //========================================================================================
  52. //    •• CLASS FW_CShape
  53. //========================================================================================
  54.  
  55. class FW_CShape : public FW_CGraphicObjectPtr
  56. {
  57. //----------------------------------------------------------------------------------------
  58. //    • Constructors
  59. //
  60. public:
  61.     FW_CShape();
  62.     FW_CShape(const FW_CShape& other);
  63.     FW_CShape(FW_CShapeRep* rep);
  64.             
  65. //----------------------------------------------------------------------------------------
  66. //    • Operators
  67. //
  68. public:
  69.     FW_CShape& operator=(const FW_CShape& other);
  70.     FW_CShape& operator=(FW_CShapeRep* other);
  71.  
  72.     FW_CShapeRep* operator->() const
  73.                 {return (FW_CShapeRep*)GetRep();}
  74. };
  75.  
  76. //==============================================================================
  77. //    •• class FW_CShapeRep
  78. //==============================================================================
  79.  
  80. class FW_CShapeRep : public FW_CGraphicObjectRep
  81. {
  82.  
  83. //------------------------------------------------------------------------------
  84. //    • Constructors/Destructors
  85. //
  86. public:
  87.     virtual ~FW_CShapeRep();
  88.  
  89. protected:
  90.     FW_CShapeRep();
  91.     FW_CShapeRep(const FW_CShapeRep& shapeRep);
  92.     FW_CShapeRep(const FW_SDefaultProperties& defaultProperties);
  93.     
  94. //------------------------------------------------------------------------------
  95. //    • New API
  96. //
  97. public:
  98.     // ----- Rendering -----
  99.     virtual void     Draw(FW_CGraphicContext* graphicContext) = 0;
  100.     
  101.     // ----- Hit Testing -----
  102.     virtual FW_HitTestPart HitTest(const FW_CPoint& test) const = 0;
  103.     
  104.     // ----- Transform -----
  105.     virtual void    Transform(XMPTransform* transform) = 0;
  106.     virtual void    InverseTransform(XMPTransform* transform) = 0;
  107.  
  108.     virtual void    MoveShape(XMPCoordinate deltaX, XMPCoordinate deltaY) = 0;
  109.     virtual void    MoveShapeTo(XMPCoordinate x, XMPCoordinate y) = 0;
  110.     
  111.     // ----- Geometry -----
  112.     virtual FW_CRect GetShapeBounds() const = 0;
  113.     
  114.     // ----- Default shape -----
  115.     virtual void     SetAsDefault() const = 0;
  116.     
  117.     // ----- Getters/Setters -----
  118.     FW_ShapeFills    GetShapeFill() const
  119.                         {return fShapeFill;}
  120.     void            SetShapeFill(FW_ShapeFills shapeFill)
  121.                         {fShapeFill = shapeFill;}
  122.                         
  123.     FW_CInk            GetShapeInk() const
  124.                         {return fShapeInk;}
  125.     void            SetShapeInk(FW_CInk newInk)
  126.                         {fShapeInk = newInk;}
  127.     
  128.     FW_CStyle        GetShapeStyle() const
  129.                         {return fShapeStyle;}
  130.     void            SetShapeStyle(FW_CStyle newStyle)
  131.                         {fShapeStyle = newStyle;}
  132.     
  133.     FW_HitTestPart    GetHitTestPart() const
  134.                         {return fHitTestPart;}
  135.     void            SetHitTestPart(FW_HitTestPart hitTestPart)
  136.                         {fHitTestPart = hitTestPart;}
  137.     
  138.     XMPCoordinate    GetHitTestTolerance() const
  139.                         {return fTolerance;}
  140.     void            SetHitTestTolerance(XMPCoordinate tolerance)
  141.                         {fTolerance = tolerance;}
  142.                         
  143.     // ----- Style access -----
  144.     XMPCoordinate    GetPenSize() const
  145.                         {return fShapeStyle->GetPenSize();}
  146.     void            SetPenSize(XMPCoordinate penSize);
  147.  
  148.     void            GetPattern(FW_CPattern& pattern) const
  149.                         {fShapeStyle->GetPattern(pattern);}
  150.     void            SetPattern(const FW_CPattern& pattern);
  151.  
  152.     void            SetFontSize(XMPCoordinate fontSize);
  153.     XMPCoordinate     GetFontSize() const
  154.                         {return fShapeStyle->GetFontSize();}
  155.  
  156.     void            SetFontStyle(FW_FontStyle fontStyle);
  157.     FW_FontStyle     GetFontStyle() const
  158.                         {return fShapeStyle->GetFontStyle();}
  159.  
  160.     void            SetFontName(const FW_CDynamicString& fontName);
  161.     void            GetFontName(FW_CDynamicString& fontName) const
  162.                         {fShapeStyle->GetFontName(fontName);}
  163.  
  164.     // ----- Ink access -----
  165.     void            GetForeColor(FW_CColor* color) const
  166.                         {fShapeInk->GetForeColor(color);}
  167.     void            SetForeColor(const FW_CColor& color);
  168.  
  169.     void            GetBackColor(FW_CColor* color) const
  170.                         {fShapeInk->GetBackColor(color);}
  171.     void            SetBackColor(const FW_CColor& color);
  172.  
  173.     FW_TransferMode    GetTransferMode() const
  174.                         {return fShapeInk->GetTransferMode();}
  175.     void            SetTransferMode(FW_TransferMode transferMode);
  176.  
  177. protected:
  178.     void            SetDefaultProperties(FW_SDefaultProperties& defaultProperties) const;
  179.  
  180. private:
  181.     void            NewInkIfShared();
  182.     void            NewStyleIfShared();
  183.     
  184. //------------------------------------------------------------------------------
  185. //    • Data Members
  186. //
  187. private:
  188.     FW_CInk                fShapeInk;
  189.     FW_CStyle            fShapeStyle;
  190.     FW_ShapeFills        fShapeFill;
  191.     FW_HitTestPart        fHitTestPart;
  192.     XMPCoordinate        fTolerance;
  193. };
  194.  
  195. #endif